﻿package com.PlantVsZombies.Plants;

import java.awt.Graphics;
import java.awt.Image;

import com.PlantVsZombies.common.Plant;
import com.PlantVsZombies.constant.PlantType;
import com.PlantVsZombies.util.ImageUtil;

public class QhPlant extends Plant{

	Image plantImage;
	PlantType planttype;
	public QhPlant(int x,int y,PlantType pt){
		this.x = x;
		this.y = y;
		this.life = 5;
		this.planttype = pt;
		switch(pt){
		case QH1:
			this.plantImage = ImageUtil.LoadImage(ImageUtil.QH1);
			break;
		case QH2:
			this.plantImage = ImageUtil.LoadImage(ImageUtil.QH2);
			break;
		case QH3:
			this.plantImage = ImageUtil.LoadImage(ImageUtil.QH3);
			break;
			
		}
	}
	@Override
	public PlantType getType() {
		return planttype;
	}

	@Override
	public void drawMe(Graphics g, int x2, int y2) {
		g.drawImage(plantImage, x2, y2-80, null);
	}

	@Override
	public void shootBullet() {
		
	}
	@Override
	public int doRun() {
		if(life>0)
			life--;
			if(life==0){
				this.setLive(false);
				return 0;
			}
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		return 1;
	}

}
